package com.suke.czx.modules.tb.controller;

import java.util.Map;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.suke.czx.modules.tb.entity.TbCommentLikes;
import com.suke.czx.modules.tb.service.TbCommentLikesService;
import com.suke.zhjg.common.autofull.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import com.suke.czx.common.annotation.SysLog;
import com.suke.czx.common.base.AbstractController;


/**
 * 评论点赞表
 *
 * @author developer
 * @email developer@163.com
 * @date 2025-05-17 21:50:44
 */
@RestController
@AllArgsConstructor
@RequestMapping("/tb/commentLike")
@Api(value = "TbCommentLikesController", tags = "评论点赞表")
public class TbCommentLikesController extends AbstractController {
    private final TbCommentLikesService tbCommentLikesService;

    /**
     * 列表
     */
    @ApiOperation(value = "评论点赞表列表")
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        QueryWrapper<TbCommentLikes> queryWrapper = new QueryWrapper<>();
        final String keyword = mpPageConvert.getKeyword(params);
        if (StrUtil.isNotEmpty(keyword)) {

        }
        IPage<TbCommentLikes> listPage = tbCommentLikesService.page(mpPageConvert.<TbCommentLikes>pageParamConvert(params), queryWrapper);
        return R.ok().setData(listPage);
    }


    /**
     * 新增评论点赞表
     */
    @ApiOperation(value = "新增评论点赞表数据")
    @SysLog("新增评论点赞表数据")
        @PostMapping()
        public R save(@RequestBody TbCommentLikes tbCommentLikes) {
        tbCommentLikesService.save(tbCommentLikes);
        return R.ok();
    }


    /**
     * 修改
     */
    @ApiOperation(value = "修改评论点赞表数据")
    @SysLog("修改评论点赞表数据")
        @PutMapping()
        public R update(@RequestBody TbCommentLikes tbCommentLikes) {
        tbCommentLikesService.updateById(tbCommentLikes);
        return R.ok();
    }


    /**
     * 删除
     */
    @ApiOperation(value = "删除评论点赞表数据")
    @SysLog("删除评论点赞表数据")
        @DeleteMapping()
        public R delete(@RequestBody TbCommentLikes tbCommentLikes) {
        tbCommentLikesService.removeById(tbCommentLikes.getCommentLikeId());
        return R.ok();
    }

}
